using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace RiceShop.Models
{
    /// <summary>
    /// 用户优惠券实体类
    /// </summary>
    [Table("UserCoupon")]
    public class UserCoupon
    {
        /// <summary>
        /// 用户优惠券ID
        /// </summary>
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public long UserId { get; set; }

        /// <summary>
        /// 优惠券ID
        /// </summary>
        public long CouponId { get; set; }

        /// <summary>
        /// 状态（0:未使用,1:已使用,2:已过期）
        /// </summary>
        public byte Status { get; set; }

        /// <summary>
        /// 使用时间
        /// </summary>
        public DateTime? UseTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 关联的用户
        /// </summary>
        [ForeignKey("UserId")]
        public virtual User User { get; set; } = null!;

        /// <summary>
        /// 关联的优惠券
        /// </summary>
        [ForeignKey("CouponId")]
        public virtual Coupon Coupon { get; set; } = null!;
    }
}